<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rest参数</title>
</head>
<body>
    
</body>
<script>
    //rest参数用于接收多余参数，代替ES5中的arguments
    //ES5 arguments实例
    function fn1(a,b){
        console.log(arguments);
    }
    fn1(1,2,3,4);

    //rest实例 所接受的多余参数，作为数组保存
    function fn2(a,b,...args){
        console.log(`${a},${b},${args}`);
        console.log(args);
    }
    fn2(1,2,3,4);

</script>
</html>